package com.tepth.busfix.base;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;

import butterknife.ButterKnife;
import butterknife.Unbinder;

/**
 * Created by zhangyu on 2016/3/11.
 */

public abstract class BaseActivity extends AppCompatActivity {

    private Unbinder unbinder;

    public abstract int getLayoutId();

    public abstract void initView();

    public abstract void setPresenter();

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(getLayoutId());
        unbinder = ButterKnife.bind(this);
        //反射拿到Presenter实例
        setPresenter();
        initView();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        unbinder.unbind();
    }

}
